home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / dialog / cmdsock.h < prev    next >
C/C++ Source or Header  |  1996-07-31  |  864b  |  46 lines

  1. #pragma interface
  2. #ifndef CMDSOCK_H
  3. #define CMDSOCK_H
  4.  
  5. const int MAX_CLIENT=100;
  6.  
  7. struct SOCK_INFO{
  8.     int handle;        // Handle (not only sockets)
  9.     struct {
  10.         int set;    // Max delay without activity
  11.         int cur;    // Activity accumulator
  12.     }idle;
  13.     int actif;        // Any activity on this handle ?
  14. };
  15.  
  16.  
  17.  
  18. class CMDSOCK{
  19.     int listen_handle;
  20.     SOCK_INFO inf[MAX_CLIENT];
  21.     int nbcli;            // How many active connexion in
  22.                     // inf[]
  23.     int actif;            // Current index in tbactif[],
  24.                     // see readnext().
  25.     /*~PROTOBEG~ CMDSOCK */
  26. public:
  27.     CMDSOCK (const char *portname);
  28.     CMDSOCK (int port);
  29.     void addcli (int fd);
  30.     void addcli (int fd, int timeout);
  31.     void closecli (int fd);
  32.     int getnbcli (void);
  33. private:
  34.     void init (int port);
  35. public:
  36.     int is_ok (void);
  37.     int listen (long timeout);
  38.     int readnext (void *buf, int size, int &cli);
  39.     ~CMDSOCK (void);
  40.     /*~PROTOEND~ CMDSOCK */
  41. };
  42.  
  43.  
  44. #endif
  45.  
  46.